package com.hutianao.gqgl.information.pmi.service.impl;

import com.hutianao.gqgl.information.bspi.respository.BspiDao;
import com.hutianao.gqgl.information.pmi.entity.SearchPmiEntity;
import com.hutianao.gqgl.information.pmi.respository.PmiDao;
import com.hutianao.gqgl.information.pmi.service.PmiService;
import com.hutianao.gqgl.mybatis.entity.PmiEntity;
import com.hutianao.gqgl.mybatis.flexigrid.PaddingEntity;
import com.hutianao.gqgl.mybatis.flexigrid.PadingRstType;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class PmiServiceImpl implements PmiService {
    @Resource
    private PmiDao pmiDao;

    @Override
    public PadingRstType<PmiEntity> queryPmiInfoListByPage(SearchPmiEntity search, PaddingEntity padding) {
        padding.deal(PmiEntity.class);
        PadingRstType<PmiEntity> padingRstType = new PadingRstType<>();
        padingRstType.setPage(padding.getPage());
        List<PmiEntity> list = pmiDao.queryPmiInfoListByPage(search,padding);
        padingRstType.setRawRecords(list);
        Integer total = pmiDao.queryPmiInfoTotal(search);
        padingRstType.setTotal(total);
        padingRstType.putItems();

        return padingRstType;
    }
}
